#include "Imshow_frame.h"
#include <QPainter>
#include <QStatusBar>
#include <QPen>

Imshow_frame::Imshow_frame(QWidget *parent,int pos_x,int pos_y,int l_width,int l_height)
    :QFrame(parent)
{
    this -> setGeometry(pos_x,pos_y,l_width,l_height);
    this -> setFrameShape(Box);

}

Imshow_frame::~Imshow_frame()
{

}

void Imshow_frame::mousePressEvent(QMouseEvent *event)
{
    mouse_x = event->x();
    mouse_y = event->y();

}

void Imshow_frame::paintEvent(QPaintEvent *e)
{
    QPainter painter(this);
    QPen pen;
    pen.setStyle(Qt::SolidLine);
    pen.setColor(QColor(0,0,220));
    painter.drawRect(0,0,this->geometry().width()-1,this->geometry().height()-1);
    if(imgshow_flag)
    {
        QPixmap pixmap(frame_filename);
        QPixmap new_pixmap = pixmap.scaled(this->geometry().width(),this->geometry().height());
        painter.drawPixmap(0,0,new_pixmap);
    }
    this->update();
    painter.end();
}
